import os
from google.appengine.api import users
from google.appengine.ext.webapp import template
from google.appengine.ext import webapp
from google.appengine.ext import db
from awsmpg import AwesomePage
from sheet_model import Sheet

class SheetsPage(AwesomePage):
	def OnGet(self):
		return True 
	def IsSecure(self):
		return True
	def head_template(self):
		return "sheets.head.htm"
	def content_template(self):
		return "sheets.content.htm"
	def head_dataset(self):
		return {}
	def content_dataset(self):
		sheets = Sheet.gql('ORDER BY date DESC')

		dataset = []
		for sheet in sheets:
			item = {}
			item["date"] = sheet.date.strftime("%d.%m")
			item["description"] = sheet.description
			dataset.append(item)
		return {'sheets': dataset}
